
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
import os
import threading

def cal_pool(num):
    print(num)
    return num**3

def outter(target_list):
    def done(response):
        target_list.append(response.result())
    return done

if __name__ == '__main__':
    source_list = [1,2,3]
    pool = ProcessPoolExecutor(3)

    target_list = []
    for i in source_list:
        f = pool.submit(cal_pool,i)
        f.add_done_callback(outter(target_list))
    pool.shutdown()
    print(target_list)